# 作业：Agent项目

import os
import time

import langchain_core.utils.function_calling as utils
import openai
from langchain.agents.format_scratchpad import format_to_openai_functions
from langchain.agents.output_parsers import OpenAIFunctionsAgentOutputParser
from langchain_core.prompts import MessagesPlaceholder
from pydantic import Field
from pydantic.v1 import BaseModel
# 导入langchain的tool
from langchain.tools import tool
import requests
import datetime
import wikipedia
from langchain.tools.render import format_tool_to_openai_function
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.schema.agent import AgentFinish
from langchain.schema.runnable import RunnablePassthrough
from langchain.agents import AgentExecutor
from langchain.memory import ConversationBufferMemory

openai.api_key = "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"
os.environ['OPENAI_API_KEY'] = "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"


# 一、Tools
# 定义一个函数用来查找员工积分的工具（创建一个pydantic类）
class get_employee_point(BaseModel):
    employeeName: str = Field(..., description="需要获取员工的姓名")
    employeePoit: int = Field(..., description="需要获取员工的分数")


# 定义一个函数用来查找奖品的所需积分的工具（创建一个pydantic类）
class get_prize_point(BaseModel):
    prizeName: str = Field(..., description="需要获取奖品的名称")
    prizePoit: int = Field(..., description="需要获取奖品的分数")

# 定义一个函数用来返回现在能积累积分的活动（创建一个pydantic类）
class get_point_activity(BaseModel):
    activityName: str = Field(..., description="需要获取活动的名称")
